home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 1
/
SPACE - Library 1 - Volume 1.iso
/
program
/
114
/
pathfind.lst
< prev
next >
Wrap
File List
|
1987-11-28
|
3KB
|
72 lines
' Procedure Set_path will call up the the file selector box with the systems
' default pathname, the default filename, and default extention search pattern.
' The procedure will find the default path by itself.
' YOU must call this procedure with :
' 1st - a string which is the default filename. ie "EXAMPLE.TXT" or ""
' 2nd - a string which is the default extension search pattern, ie "BAS" "DOC"
' 3rd - a string variable name which has an astrisk in front of it, indicating
' a return variable. After the routine finishes it puts the selected
' filename in that string, such as "HELLO.TXT" or "TEXTWORK.BAS".
'
' Procedure Deafult_path simply returns the systems default path. You must
' call it with a string variable name with an asterisk in front of it to
' indicate that this is a return string variable. When this routine is done
' it will place the deafult path name into this string variable.
'
' Note that selecting CANCEL will keep the defaults the same.
'
Do
@Set_path(F$,"BAS",*F$)
@Default_path(*A$) !Sample loop to show how to use the two procedures.
Print A$,F$
Loop
'
'
'
'
'
' ---------======<<<(( determines system default directory ))>>>======---------
' input variables : none.
' returned variables: Present_path (pointer to string variable containing
' currently recognized directory.)
'
Procedure Default_path(Present_path)
Local Default_drive$
Default_drive$=Chr$(Gemdos(25)+65)
*Present_path=Default_drive$+":"+Dir$(Gemdos(25)+1)+"\"
Return
'
'
'
' ---------======<<<(( user sets system default-directory ))>>>======---------
' input variables : Default_file$ (Default file name)
' : Extension$ (extension to filename for search pattern)
' returned variables: File_selected (returns filename selected)
'
Procedure Set_path(Default_file$,Extension$,File_selected)
Local Starting_path$,Selected_path$,Size_name,File_name$,Default_drive$
Default_drive$=Chr$(Gemdos(25)+65)
Starting_path$=Default_drive$+":"+Dir$(Gemdos(25)+1)+"\"
If Extension$=""
Extention$="*"
Endif
If Default_file$=""
Default_file$=""
Endif
Fileselect Starting_path$+"*."+Extension$,Default_file$,Selected_path$
If Selected_path$=""
Goto No_change
Endif
Chdrive Asc(Left$(Selected_path$,1))-64
File_path$=Right$(Selected_path$,Len(Selected_path$)-2)
Size_name=Len(Selected_path$)
Do
Exit If Mid$(Selected_path$,Size_name,1)="\"
File_name$=Mid$(Selected_path$,Size_name,1)+File_name$
Dec Size_name
Loop
Chdir Left$(Selected_path$,Len(Selected_path$)-Len(File_name$))
*File_selected=File_name$
No_change:
Return